#include "MarkMsg.h"

#include <windows.h>
#include <assert.h>

DWORD WINAPI tfunc(LPVOID para) {
	int i;
	for (i = 0; i < 16; ++i) {
		MarkMsg_Now(para, 1, "hello world");
	}
	return 0;
}


int main(void) {
	struct MarkMsg *pMarkMsg;
	HANDLE ThreadList[16];
	
	pMarkMsg = MarkMsg_Init("t.exe.debug.txt");

	{
		int i;
		for (i = 0; i < 16; ++i) {
			ThreadList[i] = (HANDLE)_beginthreadex(0, 0, tfunc, pMarkMsg, 0, 0);
			assert(ThreadList[i]);
		}

		for (i = 0; i < 16; ++i) {
			WaitForSingleObject(ThreadList[i], INFINITE);
			CloseHandle(ThreadList[i]);
		}
	}
	MarkMsg_Release(pMarkMsg);
	return 0;
}
